package com.stu.day07;

/**
 * @author zy
 * @date 2025/1/27 18:58
 */
public class Main {
    public static void main(String[] args) {
        // 创建几个书籍对象
        Book b1 = new Book("The Great Gatsby", "F. Scott Fitzgerald", 10.99);
        Book b2 = new Book("To Kill a Mockingbird", "Harper Lee", 7.99);
        Book b3 = new Book("1984", "George Orwell", 8.99);
        Book b4 = new Book("Moby Dick", "Herman Melville", 12.99);

        // 创建图书馆对象
        Library library = new Library();

        // 业务操作：添加书籍
        library.addBook(b1);
        library.addBook(b2);
        library.addBook(b3);
        library.addBook(b4);

        // 业务操作：打印所有书籍
        System.out.println("All books:");
        library.printAllBooks();

        // 业务操作：按价格升序排序
        library.sortBooksByPrice();

        // 业务操作：按书名排序
        library.sortBooksByTitle();

        // 业务操作：按价格降序排序
        library.sortBooksByPriceDesc();

        // 业务操作：使用内部类来排序
        library.sortBooksUsingInternalClass();

        // 业务操作：删除书籍
        library.removeBookByTitle("1984");
        System.out.println("After removal of book '1984':");
        library.printAllBooks();
    }
}
